import Vue from "vue"
import Router from "vue-router"
import Layout from '@/layout/index'

Vue.use(Router);

export default new Router({
  routes: [
    //登录
    {
      path: '/login',
      name: 'login',
      component: () => import("@/views/login")
    },

    // 首页
    {
      path: '/',
      component: Layout,
      redirect: '/home',
      children: [{
        path: '/home',
        name: 'home',
        component: () => import("@/views/home")
      }]
    },

    // 用户
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: '/user',
          name: 'user',
          component: () => import("@/views/user"),
          meta: {
            isKeepAlive: true
          }
        }
      ]
    },
    // 角色
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: '/role',
          name: 'role',
          component: () => import("@/views/role")
        }
      ]
    },

    // 菜单
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: '/menu',
          name: 'menu',
          component: () => import("@/views/menu")
        }
      ]
    },
    // 个人中心
    {
      path: '/layout',
      component: Layout,
      children: [
        {
          path: '/center',
          name: 'center',
          component: () => import("@/views/center")
        }
      ]
    },
  ]
});
